package org.opu.db.obj.vis.ui.client.tablerenders;

import java.util.Collection;
import java.util.Collections;
import org.opu.db.obj.vis.domain.domains.AbstractEntity;
import org.opu.db.obj.vis.ui.client.BeanView;

public class TableRenderNull implements TableRender<AbstractEntity>{

	@Override
	public Class<AbstractEntity> getRenderingClass() {
		return AbstractEntity.class;
	}

	@Override
	public void rendView(Collection<? extends AbstractEntity> beans, BeanView view) {
		view.setContent(new Object[]{}, new Class<?>[]{}, new Object[][]{{}});
	}

	public void rendView(Object[][] data, String[] header, BeanView view) {
		view.setContent(header, nCopiesOfClass(header.length), data);
	}

    private Class[] nCopiesOfClass(int length) {
        return Collections.nCopies(length, String.class).toArray(new Class[]{});
    }

}
